<!DOCTYPE html>
<html lang="zh-cn">

<head>

  <meta content="text/html;charset=utf-8" http-equiv="content-type">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

  <title>滑雪族 - 首页管理</title>

  <!-- Bootstrap Core CSS -->
<!-- MetisMenu CSS -->
<!-- Custom CSS -->
<!-- Custom Fonts -->
  <!-- Timeline CSS -->
  <!-- Morris Charts CSS -->
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
  <!--webuploader 引入CSS-->

    <link rel="stylesheet" href="/server/r/bower_components/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/server/r/bower_components/metisMenu/dist/metisMenu.min.css" />
    <link rel="stylesheet" href="/server/r/static/css/sb-admin-2_e507c2b.css" />
    <link rel="stylesheet" type="text/css" href="/server/r/bower_components/font-awesome/css/font-awesome.min.css" />
    <link type="text/css" rel="stylesheet" href="/server/r/static/css/hxz/common_2baa698.css" />
    <link rel="stylesheet" href="/server/r/static/css/timeline_1c13c9f.css" />
    <link rel="stylesheet" href="/server/r/bower_components/morrisjs/morris.css" />
    <link rel="stylesheet" type="text/css" href="/server/r/bower_components/alertify/themes/alertify.core.css" />
    <link rel="stylesheet" type="text/css" href="/server/r/bower_components/alertify/themes/alertify.bootstrap.css" />
    <link type="text/css" rel="stylesheet" href="/server/r/bower_components/select2/dist/css/select2.min.css" />
    <link rel="stylesheet" type="text/css" href="/server/r/bower_components/fex-webuploader/dist/webuploader.css" />
    <link rel="stylesheet" href="/server/r/bower_components/bootstrap-daterangepicker/daterangepicker.css" />
</head>

<body>
<div id="wrapper">
  <!-- Navigation -->
  <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">

    <div class="navbar-header">
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </button>
  <a class="navbar-brand" href="activity-list">滑雪族 管理</a>
</div>
<!-- /.navbar-header -->

<ul class="nav navbar-top-links navbar-right">
  <!-- /.dropdown -->
  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
      <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
    </a>
    <ul class="dropdown-menu dropdown-user">
      <li><a href="/manage/logout"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a>
      </li>
    </ul>
    <!-- /.dropdown-user -->
  </li>
  <!-- /.dropdown -->
</ul>
<!-- /.navbar-top-links -->

    <div class="navbar-default sidebar" role="navigation">
      <div class="sidebar-nav navbar-collapse">
        <ul class="nav" id="side-menu">
  <li>
    <a href="#"><i class="fa fa-asterisk fa-fw"></i> 产品管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/activity-list"> 产品查询</a>
      </li>
      <li>
        <a href="/manage/manage-organizer-render-activity"> 产品显示控制</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="/#"><i class="fa fa-male fa-fw"></i> 报名管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/player-list"> 报名查询</a>
      </li>
    </ul>
  </li>
  <li>
    <a href="#"><i class="fa fa-list-alt fa-fw"></i> 订单管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/order-list"> 订单查询</a>
      </li>
      <li>
        <a href="/manage/refund-list"> 退款管理</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-check-circle fa-fw"></i> 主办方认证<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/organizer-edit"> 创建主办方</a>
      </li>
      <li>
        <a href="/manage/organizer-list"> 主办方列表</a>
      </li>
      <li>
        <a href="/manage/organizer-print"> 冬令营打印设置</a>
      </li>

    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-picture-o fa-fw"></i> 雪场管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/ski-field-edit"> 创建雪场</a>
      </li>
      <li>
        <a href="/manage/ski-field-list"> 雪场列表</a>
      </li>

    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-users fa-fw"></i> 教练管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/coach-list"> 预约情况</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-credit-card fa-fw"></i> 结算管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/manage-transfer-list"> 转账管理</a>
      </li>
      <li>
        <a href="/manage/manage-withdrawals-apply-list"> 提现申请</a>
      </li>
      <li>
        <a href="/manage/manage-withdrawals-record-list"> 结算列表</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-rmb fa-fw"></i> 财务管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/stream-list"> 交易流水</a>
      </li>
      <li>
        <a href="/manage/manage-bill-record-list"> 对账列表</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-dollar fa-fw"></i> 营销管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/marketing-list"> 返利管理</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-comments fa-fw"></i> 评价管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/comment-list">评价管理</a>
      </li>
    </ul>
  </li>
  <li>
    <a href="#"><i class="fa fa-tasks fa-fw"></i> 定时处理管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/quartz-list"> 定时处理列表</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
  <li>
    <a href="#"><i class="fa fa-wechat fa-fw"></i> 微信页面管理<span class="fa arrow"></span></a>
    <ul class="nav nav-second-level">
      <li>
        <a href="/manage/typography-list"> 微信首页管理</a>
      </li>
      <li>
        <a href="/manage/activity-weight-manage"> 活动置顶</a>
      </li>
    </ul>
    <!-- /.nav-second-level -->
  </li>
</ul>
      </div>
      <!-- /.sidebar-collapse -->
    </div>
    <!-- /.navbar-static-side -->
  </nav>
  <input type="hidden" id="domain" value="${domain}">
  <input type="hidden" id="targetType-value">

  <!--场次二维码的模态窗口-->
  <div class="modal fade" id="preview-qrcode" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
       aria-hidden="true">
    <div class="modal-dialog" style="width: 360px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">预览二维码</h4>
          <h5 class="modal-subtitle"></h5>
          <h6>用户扫描下方的二维码，可以预览编辑后的首页信息。注意，点击同步按钮会将用户编辑的信息同步到主站。</h6>
        </div>
        <div class="modal-body">
          <div id="code1" style="text-align: center;"></div>
        </div>
      </div>
      <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
  </div>


  <!-- 添加位置信息的模态窗口-->
  <div class="modal fade" id="typography-add-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
       aria-hidden="true">
    <div class="modal-dialog" style="width: 60%;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h5 class="modal-title">添加信息</h5>
        </div>
        <div class="modal-body">
          <table class="table table-bordered table-striped">
            <input id="modal-typography-id" type="hidden">
            <thead></thead>
            <tbody>
            <tr>
              <td>位置:</td>
              <td>
                <select class="form-control" id="modal-typography-type"></select>
              </td>
            </tr>
            <tr>
              <td>关联类型:</td>
              <td>
                <select class="form-control" id="modal-targetType"></select>
              </td>
            </tr>
            <tr>
              <td>关联产品:</td>
              <td>
                <select class="form-control" id="modal-targetId"></select>
              </td>
            </tr>
            <tr>
              <td>标题:</td>
              <td><input id="modal-title" style="width:400px"></td>
            </tr>
            <tr>
              <td>图片:</td>
              <td>
                <img id="modal-image" style="width:300px">

                <div class="pull-right" id="uploader">
                  <div id="filePicker">上传图片</div>
                </div>
              </td>
            </tr>
            <tr>
              <td>跳转链接:</td>
              <td><input id="modal-href" style="width:600px"></td>
            </tr>
            </tbody>
          </table>
        </div>
        <div class="modal-footer">
          <a id="typography-save-btn" href="javascript:void(0);" type="button"
             class="btn btn-success">保存</a>
          <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        </div>
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>


<div id="page-wrapper">
  <div class="row">
    <div class="col-lg-12">
      <h3 class="page-header">首页管理</h3>
    </div>
    <!-- /.col-lg-12 -->
  </div>
  <!-- /.row -->
  <div class="form-inline">
    <div class="form-group">
      <label>位置：</label>
      <select class="form-control" id="typography-type"></select>
    </div>
    <div class="form-group">
      <a id="typography-filter" type="button" class="btn btn-sm btn-success btn-outline">查询</a>
      <a id="typography-add" type="button" class="btn btn-sm btn-success">添加内容</a>
      <a id="typography-sys" type="button" class="btn btn-sm btn-success btn-outline">同步首页</a>
      <a id="typography-qrcode" type="button" class="btn btn-sm btn-success btn-outline">预览</a>
    </div>
  </div>


  <div class="row">
    <div class="col-lg-12">
      <div class="panel panel-default">
        <div class="panel-heading">
          位置信息列表
        </div>
        <!-- /.panel-heading -->
        <div class="panel-body">
          <div class="dataTable_wrapper">
            <table class="table table-striped table-bordered table-hover">
              <thead>
              <tr>
                <th>ID</th>
                <th>标题</th>
                <th>图片</th>
                <th>跳转链接</th>
                <th>关联类型</th>
                <th>关联ID</th>
                <th>操作</th>
              </tr>
              </thead>
              <tbody id="list-body"></tbody>
            </table>
          </div>

          <!-- /.row -->
          <div class="pagination dataTables_paginate paging_simple_numbers pull-right" id="pagination" role="status"
               aria-live="polite">
          </div>
        </div>
        <!-- /.panel-body -->
      </div>
      <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
  </div>
</div>
<!-- /#page-wrapper -->

</div>
<!-- /#wrapper --><script id="tpl-player-list-item" type="text/template">
  <tr>
    <td>{{typographyId}}</td>
    <td>{{title}}</td>
    <td><img src="{{image}}" style="width: 200px;"></td>
    <td>{{href}}</td>
    <td>{{targetTypeStatus(targetType)}}</td>
    <td>{{targetId}}</td>
    <td>
      <a type="button" data-code="{{typographyId}}" class="btn btn-success btn-xs  btn-outline delete-typography">删除</a>
      <a type="button" data-code="{{typographyId}}" class="btn btn-success btn-xs  btn-outline update-typography">修改</a>
      <a type="button" data-code="{{typographyId}}" class="btn btn-success btn-xs  btn-outline moveUp-typography">优先</a>
      <a type="button" data-code="{{typographyId}}"
         class="btn btn-success btn-xs  btn-outline moveDown-typography">置后</a>
    </td>
  </tr>
</script>
<div id="hxz-background" class="background" style="display: none; "></div>
<div id="hxz-progressBar" class="progressBar" style="display: none; ">数据加载中，请稍等...</div>

<script src="/server/r/require.js"></script>
<script type="text/javascript">/*resourcemap*/
require.config({paths:{
  "r/bower_components/jquery/dist/jquery.min": "/server/r/bower_components/jquery/dist/jquery.min",
  "r/bower_components/underscore/underscore-min": "/server/r/bower_components/underscore/underscore-min",
  "r/static/js/hxz/hxz.valid": "/server/r/static/js/hxz/hxz.valid_12cc206",
  "r/static/js/hxz/hxz.rest": "/server/r/static/js/hxz/hxz.rest_07c8105",
  "r/bower_components/alertify/alertify.min": "/server/r/bower_components/alertify/alertify.min",
  "r/static/js/alertify-config": "/server/r/static/js/alertify-config_0cc8db2",
  "r/bower_components/bootstrap/dist/js/bootstrap.min": "/server/r/bower_components/bootstrap/dist/js/bootstrap.min",
  "r/bower_components/metisMenu/dist/metisMenu.min": "/server/r/bower_components/metisMenu/dist/metisMenu.min",
  "r/bower_components/select2/dist/js/select2": "/server/r/bower_components/select2/dist/js/select2",
  "r/static/js/hxz/hxz.ui": "/server/r/static/js/hxz/hxz.ui_0a7714d",
  "r/static/js/hxz/hxz": "/server/r/static/js/hxz/hxz_589b155",
  "r/bower_components/fex-webuploader/dist/webuploader": "/server/r/bower_components/fex-webuploader/dist/webuploader",
  "r/vendor/pagination/jquery.pagination": "/server/r/vendor/pagination/jquery.pagination",
  "r/bower_components/jquery-qrcode/jquery.qrcode.min": "/server/r/bower_components/jquery-qrcode/jquery.qrcode.min"
}});

  require(["r/bower_components/jquery/dist/jquery.min", "r/static/js/hxz/hxz", "r/static/js/alertify-config", "r/bower_components/fex-webuploader/dist/webuploader", "r/vendor/pagination/jquery.pagination", "r/bower_components/select2/dist/js/select2", "r/bower_components/jquery-qrcode/jquery.qrcode.min"], function ($, hxz, alertify, WebUploader) {

    var pagination = {};
    var typographyFilter = {};
    var tmpList = {};


    function initUploader() {

      $("#filePicker").remove();
      $("#uploader").append('<div id="filePicker">上传图片</div>');
      // 初始化Web Uploader
      var uploader = WebUploader.create({
        // 选完文件后，是否自动上传。
        auto: true,
        // swf文件路径
        swf: "/server/r/bower_components/fex-webuploader/dist/Uploader.swf",
        // 文件接收服务端。
        server: 'http://image.huaxuezoo.com/upload',
        // 选择文件的按钮。可选。
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
          id: '#filePicker',
          multiple: false
        },
        // 只允许选择图片文件。
        accept: {
          title: 'Images',
          extensions: 'gif,jpg,jpeg,bmp,png',
          mimeTypes: 'image/*'
        },
        thumb: {
          width: 110,
          height: 110,
          // 图片质量，只有type为`image/jpeg`的时候才有效。
          quality: 100,
          // 是否允许放大，如果想要生成小图的时候不失真，此选项应该设置为false.
          allowMagnify: true,
          // 是否允许裁剪。
          crop: true,
          // 为空的话则保留原有图片格式。
          // 否则强制转换成指定的类型。
          type: 'image/jpeg'
        },
        compress: {}
      });

      var ajaxbg = $("#hxz-background,#hxz-progressBar");
      ajaxbg.hide();

      // 当有文件添加进来的时候
      uploader.on('fileQueued', function (file) {
        ajaxbg.show();
        uploader.makeThumb(file, function (error, src) {
          if (error) {
            $("#settlementImage").replaceWith('<span>不能预览</span>');
            return;
          }
        }, 350, 175);
      });
      uploader.on('beforeFileQueued', function (file) {
        uploader.reset();
        if (file.getSource().size > 310000) {
          alertify.error("上传图片大小不能大于300K", "danger");
          return false;
        }
      });

      // 文件上传成功，给item添加成功class, 用样式标记上传成功。
      uploader.on('uploadSuccess', function (file, response) {
        ajaxbg.hide();
        $("#modal-image").attr("src", response[0].url);

      });
    }


    function fetchOption() {
      var targetType = [{"id": 0, "text": "默认类型"}, {"id": 1, "text": "系统产品"}];
      $("#modal-targetType").select2({
        language: "zh-CN",
        placeholder: "请选择类型",
        width: "400",
        data: targetType
      });


      $("#modal-targetType").on("change", function (e) {

        var targetTypeValue = $("#modal-targetType").val();

        var targetId = [{"id": 0, "text": "无"}];
        $("#modal-title").val("");
        $("#modal-image").attr("src", "");
        $("#modal-href").val("");
        if (targetTypeValue == "1" || $("#targetType-value").val() == "1") {
          hxz.doGet({url: hxz.RestApi.manageWechatActivityOption}, function (data) {
            data.data.unshift({"id": 0, "text": ""});
            $("#modal-targetId").select2({
              language: "zh-CN",
              placeholder: "请选择类型",
              width: "400",
              data: data.data
            });
          });
        } else {
          $("#modal-targetId").select2({
            language: "zh-CN",
            placeholder: "请选择产品",
            width: "400",
            data: targetId
          });
        }
      });

      $("#modal-targetId").on("change", function (e) {

        var targetIdValue = $("#modal-targetId").val();

        if ($("#modal-targetType").val() == "1" && targetIdValue != undefined) {
          hxz.doGet({url: hxz.RestApi.manageActivityDetail + "?activityId=" + targetIdValue}, function (data) {
            $("#modal-title").val(data.data.title);
            $("#modal-image").attr("src", data.data.posterUrl);
            var url = '';
            if (data.data.activityTypeId == 7) {
              url = '/wechat/activity/hotel-detail?activityId=' + data.data.activityId;
            } else {
              if (data.data.episodeCount == 1) {
                url = '/wechat/activity/episode-detail?episodeId=' + data.data.singleEpisodeId;
              } else {
                url = '/wechat/activity/episode-list?activityId=' + data.data.activityId;
              }
            }
            $("#modal-href").val(url);
          });
        }


      });


      hxz.doGet({url: hxz.RestApi.manageTypographyTypeOption}, function (data) {
        $("#typography-type").select2({
          language: "zh-CN",
          placeholder: "请选择类型",
          width: "350",
          data: data.data
        });

        $("#modal-typography-type").select2({
          language: "zh-CN",
          placeholder: "请选择类型",
          width: "400",
          data: data.data
        });
      });
    };


    function pagination(data, callback) {
      $('#pagination').pagination(count, {
        current_page: 0,
        items_per_page: 10,
        num_display_entries: 6,
        callback: function (page) {
          //模拟ajax去后端读取页数，获取数据并渲染列表的过程
          callback(page + 1);
        },
        load_first_page: false,
        prev_text: '上一页',
        next_text: '下一页'
      });

    }

    function fetchList(page) {
      var apiList = hxz.RestApi.manageTypographyList;
      typographyFilter.page = page;

      if (typographyFilter.typeId === undefined && $("#typography-type").val() !== "") {
        typographyFilter.typeId = $("#typography-type").val();
      }

      hxz.doGet({url: hxz.getUrlByfiterOption(apiList, typographyFilter)}, function (data) {
        if (data.status == "0") {
          return alertify.log("系统错误");
        }
        tmpList = data.data.dataList;

        render(data.data.dataList, page, data.data.count);
      });
    }


    function render(dataList, page, count) {
      var tpl = _.template($('#tpl-player-list-item').html());
      $("#list-body").html("");
      for (var i = 0; i < dataList.length; i++) {
        var _data = dataList[i];
        _data.datetime = hxz.datetime;
        _data.targetTypeStatus = function (data) {
          var s = ['', '活动'];
          return s[data];
        };
        $("#list-body").append(tpl(_data));
      }

      if (pagination) {
        pagination = false;
        $('#pagination').pagination(count, {
          current_page: 0,
          items_per_page: 10,
          num_display_entries: 6,
          callback: function (page_id) {
            //模拟ajax去后端读取页数，获取数据并渲染列表的过程
            fetchList(page_id + 1);
          },
          load_first_page: false,
          prev_text: '上一页',
          next_text: '下一页'
        });
      }
    }

    function event() {
      var previewUrl = "http://" + $("#domain").val() + "/wechat/home/preview";

      $("#code1").qrcode({
        render: "canvas", //table方式 或者canvas方式
        width: 180, //宽度
        height: 180, //高度
        text: previewUrl
      });


      $("#typography-sys").unbind("click").on("click", function () {
        alertify.confirm('同步操作会将用户编辑的信息同步到主站，建议先使用预览功能进行确认', function (event) {
          // 点击确认
          if (event) {
            hxz.doGet({url: hxz.RestApi.manageTypographySys}, function (data) {

              return alertify.log(data.msg);
            });
          }
        });
      });

      $("#typography-qrcode").unbind("click").on("click", function () {
        $("#preview-qrcode").modal("show");
      });


      $("#typography-save-btn").unbind("click").on("click", function () {
        var data = {
          typographyId: $("#modal-typography-id").val(),
          typeId: $("#modal-typography-type").val(),
          targetType: $("#modal-targetType").val(),
          targetId: $("#modal-targetId").val(),
          title: $("#modal-title").val(),
          image: $("#modal-image").attr("src"),
          href: $("#modal-href").val()
        };

        hxz.doPost({url: hxz.RestApi.manageTypographySave, data: data}, function (data) {
          if (data.status == "0") {
            /*弹出提示信息*/
            return alertify.error(data.msg, "danger");
          }
          if (data.status == "1") {
            /*弹出提示信息*/
            alertify.log(data.msg);
            $("#typography-add-dialog").modal("hide");
            fetchList(1);
          }
        });

      });

      $("#typography-filter").unbind("click").on("click", function () {
        typographyFilter.typeId = ($("#typography-type").val() === "0") ? "" : $("#typography-type").val();
        pagination = true;
        fetchList(1);
      });


      $("#typography-add").unbind("click").on("click", function () {
        typographyDialogOpen();
        $("#modal-typography-type").val($("#typography-type").val()).trigger("change");
        $("#modal-targetType").val("0").trigger("change");
        $("#modal-targetId").val("0").trigger("change");
      });


      $("#list-body").on("click", ".moveUp-typography", function () {
        var data = {
          typographyId: $(this).data("code")
        };

        hxz.doPost({url: hxz.RestApi.manageTypographyMoveUp, data: data}, function (data) {
          if (data.status == "0") {
            return alertify.log("系统错误");
          }
          fetchList();
        });
      });


      $("#list-body").on("click", ".moveDown-typography", function () {
        var data = {
          typographyId: $(this).data("code")
        };

        hxz.doPost({url: hxz.RestApi.manageTypographyMoveDown, data: data}, function (data) {
          if (data.status == "0") {
            return alertify.log("系统错误");
          }
          fetchList();
        });

      });

      $("#list-body").on("click", ".delete-typography", function () {
        var data = {
          typographyId: $(this).data("code")
        };
        alertify.confirm('确定删除吗？', function (event) {
          // 点击确认
          if (event) {
            hxz.doPost({url: hxz.RestApi.manageTypographyDelete, data: data}, function (data) {
              if (data.status == "0") {
                return alertify.log("系统错误");
              }
              alertify.log("删除成功");
              fetchList();
            });
          }
        });
      });


      $("#list-body").on("click", ".update-typography", function () {
        var data = {
          typographyId: $(this).data("code")
        };
        var obj = _.findWhere(tmpList, data);
        typographyDialogOpen();

        $("#targetType-value").val(obj.targetType);
        $("#modal-typography-id").val(obj.typographyId).trigger("change");
        $("#modal-typography-type").val(obj.typeId).trigger("change");
        $("#modal-targetType").val(obj.targetType).trigger("change");
        $("#modal-targetId").val(obj.targetId + "").trigger("change");
        $("#modal-title").val(obj.title);
        $("#modal-image").attr("src", obj.image);
        $("#modal-href").val(obj.href);
      });

      $("#typography-add-dialog").on('shown.bs.modal', function () {
        initUploader();
      })

    }


    /*打开模态窗口的时候 初始化的数据*/
    function typographyDialogOpen() {
      $("#targetType-value").val("");
      $("#modal-typography-id").val("");
      $("#modal-title").val("");
      $("#modal-image").attr("src", "");
      $("#modal-href").val("");
      $("#typography-add-dialog").modal("show");
    }


    function pageInit() {
      pagination = true;
      fetchOption();
      $("#typography-type").val("1").trigger("change");
      event();
      fetchList(1);
    }

    // 执行初始化
    pageInit();

  });
</script>
</body>

</html>